<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <style>
      img {
        width: 300px;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <button @click="changeImg">点击更换图</button>
      <img v-bind:src="src" alt="" />
      <img :src="src" alt="" />
    </div>
    <script src="./vue.js"></script>
    <script>
      var vm = new Vue({
        el: "#app",
        data: {
          src: "./img/1.png",
        },
        methods: {
          changeImg() {
            this.src = "./img/2.png";
          },
        },
      });
    </script>
  </body>
</html>
